/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * MainWindow.java
 *
 * Created on 03.04.2011, 06:34:19
 */

package core.editor;

/**
 *
 * @author Philipp
 */
public class MapEditorWindow extends javax.swing.JFrame {

    /** Creates new form MainWindow */
    public MapEditorWindow() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        rightToolBar = new javax.swing.JToolBar();
        layerPanel = new javax.swing.JPanel();
        layerTableScrollPane = new javax.swing.JScrollPane();
        layerTable = new javax.swing.JTable();
        layerAddButton = new javax.swing.JButton();
        layerRemoveButton = new javax.swing.JButton();
        layerVisibleButton = new javax.swing.JButton();
        layerUpButton = new javax.swing.JButton();
        layerDownButton = new javax.swing.JButton();
        actorBrowserPanel = new javax.swing.JPanel();
        actionBrowserScrollPane = new javax.swing.JScrollPane();
        actorBrowserTree = new javax.swing.JTree();
        previewPanel = new javax.swing.JPanel();
        previewPanelDrawArea = new javax.swing.JPanel();
        drawAreaScrollPane = new javax.swing.JScrollPane();
        drawPanel = new javax.swing.JPanel();
        leftToolBar = new javax.swing.JToolBar();
        drawButton = new javax.swing.JButton();
        drawButton3 = new javax.swing.JButton();
        fillButton = new javax.swing.JButton();
        jSeparator1 = new javax.swing.JToolBar.Separator();
        magicButton = new javax.swing.JButton();
        magicButton2 = new javax.swing.JButton();
        jSeparator2 = new javax.swing.JToolBar.Separator();
        magicButton1 = new javax.swing.JButton();
        magicButton3 = new javax.swing.JButton();
        magicButton4 = new javax.swing.JButton();
        menuBar = new javax.swing.JMenuBar();
        fileMenu = new javax.swing.JMenu();
        openMenuItem = new javax.swing.JMenuItem();
        saveMenuItem = new javax.swing.JMenuItem();
        saveAsMenuItem = new javax.swing.JMenuItem();
        editMenu = new javax.swing.JMenu();
        copyMenuItem = new javax.swing.JMenuItem();
        pasteMenuItem = new javax.swing.JMenuItem();
        cutMenuItem = new javax.swing.JMenuItem();
        helpMenu = new javax.swing.JMenu();
        aboutMenuItem = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("CiviC Engine Map Editor");

        rightToolBar.setFloatable(false);
        rightToolBar.setOrientation(1);
        rightToolBar.setRollover(true);

        layerPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Layer"));

        layerTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "#", "Name", "Visible"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.String.class, java.lang.Boolean.class
            };
            boolean[] canEdit = new boolean [] {
                false, true, true
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        layerTableScrollPane.setViewportView(layerTable);
        layerTable.getColumnModel().getColumn(0).setMinWidth(0);
        layerTable.getColumnModel().getColumn(0).setMaxWidth(25);

        layerAddButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/core/resources/icons_small/edit_add.png"))); // NOI18N
        layerAddButton.setToolTipText("Add Layer");
        layerAddButton.setBorderPainted(false);

        layerRemoveButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/core/resources/icons_small/mail_delete.png"))); // NOI18N
        layerRemoveButton.setToolTipText("Remove Layer");
        layerRemoveButton.setBorderPainted(false);

        layerVisibleButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/core/resources/icons_small/edit_find.png"))); // NOI18N
        layerVisibleButton.setToolTipText("Visible");
        layerVisibleButton.setBorderPainted(false);

        layerUpButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/core/resources/icons_small/2uparrow.png"))); // NOI18N
        layerUpButton.setToolTipText("Move Up");
        layerUpButton.setBorderPainted(false);

        layerDownButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/core/resources/icons_small/2downarrow.png"))); // NOI18N
        layerDownButton.setToolTipText("Move Down");
        layerDownButton.setBorderPainted(false);

        org.jdesktop.layout.GroupLayout layerPanelLayout = new org.jdesktop.layout.GroupLayout(layerPanel);
        layerPanel.setLayout(layerPanelLayout);
        layerPanelLayout.setHorizontalGroup(
            layerPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layerPanelLayout.createSequentialGroup()
                .add(layerAddButton)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(layerRemoveButton)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 15, Short.MAX_VALUE)
                .add(layerVisibleButton)
                .add(18, 18, 18)
                .add(layerUpButton)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(layerDownButton)
                .addContainerGap())
            .add(layerTableScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 182, Short.MAX_VALUE)
        );
        layerPanelLayout.setVerticalGroup(
            layerPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layerPanelLayout.createSequentialGroup()
                .add(layerPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(layerDownButton)
                    .add(layerUpButton)
                    .add(layerAddButton)
                    .add(layerRemoveButton)
                    .add(layerVisibleButton))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(layerTableScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 217, Short.MAX_VALUE))
        );

        rightToolBar.add(layerPanel);

        actorBrowserPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Actor Browser"));

        javax.swing.tree.DefaultMutableTreeNode treeNode1 = new javax.swing.tree.DefaultMutableTreeNode("GameName");
        javax.swing.tree.DefaultMutableTreeNode treeNode2 = new javax.swing.tree.DefaultMutableTreeNode("Tilesets");
        javax.swing.tree.DefaultMutableTreeNode treeNode3 = new javax.swing.tree.DefaultMutableTreeNode("tileset1");
        javax.swing.tree.DefaultMutableTreeNode treeNode4 = new javax.swing.tree.DefaultMutableTreeNode("ground");
        treeNode3.add(treeNode4);
        treeNode4 = new javax.swing.tree.DefaultMutableTreeNode("corner");
        treeNode3.add(treeNode4);
        treeNode4 = new javax.swing.tree.DefaultMutableTreeNode("...");
        treeNode3.add(treeNode4);
        treeNode2.add(treeNode3);
        treeNode3 = new javax.swing.tree.DefaultMutableTreeNode("tileset2");
        treeNode2.add(treeNode3);
        treeNode1.add(treeNode2);
        treeNode2 = new javax.swing.tree.DefaultMutableTreeNode("Actors");
        treeNode3 = new javax.swing.tree.DefaultMutableTreeNode("Link");
        treeNode2.add(treeNode3);
        treeNode3 = new javax.swing.tree.DefaultMutableTreeNode("Luigi");
        treeNode2.add(treeNode3);
        treeNode3 = new javax.swing.tree.DefaultMutableTreeNode("Mario");
        treeNode2.add(treeNode3);
        treeNode1.add(treeNode2);
        actorBrowserTree.setModel(new javax.swing.tree.DefaultTreeModel(treeNode1));
        actionBrowserScrollPane.setViewportView(actorBrowserTree);

        org.jdesktop.layout.GroupLayout actorBrowserPanelLayout = new org.jdesktop.layout.GroupLayout(actorBrowserPanel);
        actorBrowserPanel.setLayout(actorBrowserPanelLayout);
        actorBrowserPanelLayout.setHorizontalGroup(
            actorBrowserPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(actionBrowserScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 182, Short.MAX_VALUE)
        );
        actorBrowserPanelLayout.setVerticalGroup(
            actorBrowserPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(actionBrowserScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 237, Short.MAX_VALUE)
        );

        rightToolBar.add(actorBrowserPanel);

        previewPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Preview"));

        previewPanelDrawArea.setBackground(new java.awt.Color(204, 204, 204));

        org.jdesktop.layout.GroupLayout previewPanelDrawAreaLayout = new org.jdesktop.layout.GroupLayout(previewPanelDrawArea);
        previewPanelDrawArea.setLayout(previewPanelDrawAreaLayout);
        previewPanelDrawAreaLayout.setHorizontalGroup(
            previewPanelDrawAreaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 182, Short.MAX_VALUE)
        );
        previewPanelDrawAreaLayout.setVerticalGroup(
            previewPanelDrawAreaLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 191, Short.MAX_VALUE)
        );

        org.jdesktop.layout.GroupLayout previewPanelLayout = new org.jdesktop.layout.GroupLayout(previewPanel);
        previewPanel.setLayout(previewPanelLayout);
        previewPanelLayout.setHorizontalGroup(
            previewPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(previewPanelDrawArea, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        previewPanelLayout.setVerticalGroup(
            previewPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, previewPanelDrawArea, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        rightToolBar.add(previewPanel);

        drawAreaScrollPane.setBackground(new java.awt.Color(204, 204, 204));

        org.jdesktop.layout.GroupLayout drawPanelLayout = new org.jdesktop.layout.GroupLayout(drawPanel);
        drawPanel.setLayout(drawPanelLayout);
        drawPanelLayout.setHorizontalGroup(
            drawPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 959, Short.MAX_VALUE)
        );
        drawPanelLayout.setVerticalGroup(
            drawPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 743, Short.MAX_VALUE)
        );

        drawAreaScrollPane.setViewportView(drawPanel);

        leftToolBar.setOrientation(1);
        leftToolBar.setRollover(true);

        drawButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/core/resources/icons_medium/draw_brush.png"))); // NOI18N
        drawButton.setToolTipText("Draw");
        drawButton.setBorderPainted(false);
        drawButton.setFocusable(false);
        drawButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        drawButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        leftToolBar.add(drawButton);

        drawButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/core/resources/icons_medium/draw_eraser.png"))); // NOI18N
        drawButton3.setToolTipText("Erase");
        drawButton3.setBorderPainted(false);
        drawButton3.setFocusable(false);
        drawButton3.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        drawButton3.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        leftToolBar.add(drawButton3);

        fillButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/core/resources/icons_medium/fill.png"))); // NOI18N
        fillButton.setToolTipText("Fill");
        fillButton.setBorderPainted(false);
        fillButton.setFocusable(false);
        fillButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        fillButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        leftToolBar.add(fillButton);
        leftToolBar.add(jSeparator1);

        magicButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/core/resources/icons_medium/games_solve.png"))); // NOI18N
        magicButton.setToolTipText("Magic Button");
        magicButton.setBorderPainted(false);
        magicButton.setFocusable(false);
        magicButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        magicButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        leftToolBar.add(magicButton);

        magicButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/core/resources/icons_medium/flag_red.png"))); // NOI18N
        magicButton2.setToolTipText("Set Marker");
        magicButton2.setBorderPainted(false);
        magicButton2.setFocusable(false);
        magicButton2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        magicButton2.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        leftToolBar.add(magicButton2);
        leftToolBar.add(jSeparator2);

        magicButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/core/resources/icons_medium/games_config_board.png"))); // NOI18N
        magicButton1.setToolTipText("Toggle Grid");
        magicButton1.setBorderPainted(false);
        magicButton1.setFocusable(false);
        magicButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        magicButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        leftToolBar.add(magicButton1);

        magicButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/core/resources/icons_medium/zoom_in.png"))); // NOI18N
        magicButton3.setToolTipText("Zoom In");
        magicButton3.setBorderPainted(false);
        magicButton3.setFocusable(false);
        magicButton3.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        magicButton3.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        leftToolBar.add(magicButton3);

        magicButton4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/core/resources/icons_medium/zoom_out.png"))); // NOI18N
        magicButton4.setToolTipText("Zoom Out");
        magicButton4.setBorderPainted(false);
        magicButton4.setFocusable(false);
        magicButton4.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        magicButton4.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        leftToolBar.add(magicButton4);

        menuBar.setBackground(new java.awt.Color(204, 204, 204));

        fileMenu.setBackground(new java.awt.Color(204, 204, 204));
        fileMenu.setText("File");

        openMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.META_MASK));
        openMenuItem.setIcon(javax.swing.filechooser.FileSystemView.getFileSystemView().getSystemIcon(javax.swing.filechooser.FileSystemView.getFileSystemView().getDefaultDirectory()));
        openMenuItem.setText("Open...");
        fileMenu.add(openMenuItem);

        saveMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.META_MASK));
        saveMenuItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/core/resources/icons_small/document_save.png"))); // NOI18N
        saveMenuItem.setText("Save");
        fileMenu.add(saveMenuItem);

        saveAsMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.META_MASK));
        saveAsMenuItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/core/resources/icons_small/document_save_as.png"))); // NOI18N
        saveAsMenuItem.setText("Save As...");
        fileMenu.add(saveAsMenuItem);

        menuBar.add(fileMenu);

        editMenu.setBackground(new java.awt.Color(204, 204, 204));
        editMenu.setText("Edit");

        copyMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.META_MASK));
        copyMenuItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/core/resources/icons_small/editcopy.png"))); // NOI18N
        copyMenuItem.setText("Copy");
        editMenu.add(copyMenuItem);

        pasteMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_V, java.awt.event.InputEvent.META_MASK));
        pasteMenuItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/core/resources/icons_small/editpaste.png"))); // NOI18N
        pasteMenuItem.setText("Paste");
        editMenu.add(pasteMenuItem);

        cutMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.META_MASK));
        cutMenuItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/core/resources/icons_small/editcut.png"))); // NOI18N
        cutMenuItem.setText("Cut");
        editMenu.add(cutMenuItem);

        menuBar.add(editMenu);

        helpMenu.setBackground(new java.awt.Color(204, 204, 204));
        helpMenu.setText("Help");

        aboutMenuItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/core/resources/icons_small/world.png"))); // NOI18N
        aboutMenuItem.setText("About");
        helpMenu.add(aboutMenuItem);

        menuBar.add(helpMenu);

        setJMenuBar(menuBar);

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(leftToolBar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(1, 1, 1)
                .add(drawAreaScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 914, Short.MAX_VALUE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(rightToolBar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 202, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, leftToolBar, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 762, Short.MAX_VALUE)
            .add(rightToolBar, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 762, Short.MAX_VALUE)
            .add(drawAreaScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 762, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new MapEditorWindow().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    public javax.swing.JMenuItem aboutMenuItem;
    public javax.swing.JScrollPane actionBrowserScrollPane;
    public javax.swing.JPanel actorBrowserPanel;
    public javax.swing.JTree actorBrowserTree;
    public javax.swing.JMenuItem copyMenuItem;
    public javax.swing.JMenuItem cutMenuItem;
    public javax.swing.JScrollPane drawAreaScrollPane;
    public javax.swing.JButton drawButton;
    public javax.swing.JButton drawButton3;
    public javax.swing.JPanel drawPanel;
    public javax.swing.JMenu editMenu;
    public javax.swing.JMenu fileMenu;
    public javax.swing.JButton fillButton;
    public javax.swing.JMenu helpMenu;
    public javax.swing.JToolBar.Separator jSeparator1;
    public javax.swing.JToolBar.Separator jSeparator2;
    public javax.swing.JButton layerAddButton;
    public javax.swing.JButton layerDownButton;
    public javax.swing.JPanel layerPanel;
    public javax.swing.JButton layerRemoveButton;
    public javax.swing.JTable layerTable;
    public javax.swing.JScrollPane layerTableScrollPane;
    public javax.swing.JButton layerUpButton;
    public javax.swing.JButton layerVisibleButton;
    public javax.swing.JToolBar leftToolBar;
    public javax.swing.JButton magicButton;
    public javax.swing.JButton magicButton1;
    public javax.swing.JButton magicButton2;
    public javax.swing.JButton magicButton3;
    public javax.swing.JButton magicButton4;
    public javax.swing.JMenuBar menuBar;
    public javax.swing.JMenuItem openMenuItem;
    public javax.swing.JMenuItem pasteMenuItem;
    public javax.swing.JPanel previewPanel;
    public javax.swing.JPanel previewPanelDrawArea;
    public javax.swing.JToolBar rightToolBar;
    public javax.swing.JMenuItem saveAsMenuItem;
    public javax.swing.JMenuItem saveMenuItem;
    // End of variables declaration//GEN-END:variables

}
